﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace YanForum.Engine.ViewModels
{
    public class CommentItem
    {
        public int Id { get; set; }
        public int ContentId { get; set; }
        public int CommentId { get; set; }
        public string CommentPost { get; set; }
        public int UserId {get;set;}
        public string UserName {get;set;}
        public string FullName { get; set; }
        public string Folder { get; set; }
        public string Avatar { get; set; }
        public string UserAvatar
        {
            get {
                if (string.IsNullOrEmpty(Avatar))
                    return "/Content/images/avatar-default.png";
                else
                    return YanForum.Engine.Services.BaseService.ImgServerPath + Folder + "/" + Avatar; 
            }
        }
        public DateTime CreateDate { get; set; }
        public string TimeAgo
        {
            get { return YanForum.Engine.Services.DateExtension.TimeAgo(CreateDate); }
        }
        public int TotalSubComment { get; set; }
    }

    public class CommentIndex
    {
        public List<CommentItem> ListComment { get; set; }
        public int TotalCount { get; set; }
        public int PageSize { get; set; }
        public int PageIndex { get; set; }
        public int ContentId { get; set; }
    }

    public class SubCommentIndex
    {
        public List<CommentItem> ListSubComment { get; set; }
    }

    public class ManageCommentItem
    {
        public int Id { get; set; }
        public string CommentPost { get; set; }
        public int ContentId { get; set; }
        public int UserId { get; set; }
        public string UserName { get; set; }
        public string FullName { get; set; }
        public DateTime? CreateDate { get; set; }
        public bool Approved { get; set; }
        public bool IsChecked { get; set; }
    }

    public class ManageCommentOptions
    {
        //public int ContentId { get; set; }
        public string Search { get; set; }
        public string CreateDate { get; set; }
        public bool Approved { get; set; }
        public string UserName { get; set; }

        public int PageSize { get; set; }
        public int PageIndex { get; set; }
    }

    public class ManageCommentIndex
    {
        public ManageCommentOptions Options { get; set; }
        public List<ManageCommentItem> ListComment { get; set; }
        public int TotalCount { get; set; }
        public string ReturnUrl { get; set; }
        public CommentBulkAction BulkAction { get; set; }
    }

    public enum CommentBulkAction
    {
        Delete = 1,
        Approved = 2
    }
}
